j3deditor.bin.hierarchy
Class J3DeScene

java.lang.Object
  extended by j3deditor.bin.hierarchy.HierarchyNode
      extended by j3deditor.bin.hierarchy.J3DeScene
All Implemented Interfaces:
Pasteable, VirtualScene, VirtualScene3D

public class J3DeScene
extends HierarchyNode
implements Pasteable, VirtualScene3D

Represents one scene. Contains an instance of javax.media.j3d.BranchGroup and list of nodes attached directly to it.

Author:
Risto Seene
See Also:
BranchGroup

Constructor Summary
J3DeScene(java.lang.String name)
          Creates an instance of J3DeScene with the given name.
J3DeScene(java.lang.String name, java.lang.String filePath)
          Creates an instance of J3DeScene with the given name and if possible loads its contents from specified file.
 
Method Summary
 void addNewObject(J3DeObject object)
          Adds the specified object to this scene.
 void addNewObjects(J3DeObject[] objects)
          Adds an array of objects to this scene.
 void copyObjects()
          Copies all selected objects from this scene.
 void cutObjects()
          Cuts all selected objects from this scene.
 void deleteObjects(HierarchyNode[] objects)
          Deletes specified objects from this scene.
 void deleteScene()
          Detaches BranchGroup object and removes this scene from HierarchyManager that contains it.
 void detach()
          Detatces BranchGroup.
 javax.media.j3d.BranchGroup getBranchGroup()
          Returns the BranchGroup object of this scene.
 J3DeCamera getCamera()
          Returns the J3DeCamera object that manages the ViewingPlatform of this scene.
 HierarchyNode getChild(int index)
          Returns the child at the specified index.
 HierarchyNode[] getCopiedObjects()
          Returns the array of copied objects.
 java.lang.String getFile()
          Returns the name of file bounded to this scene.
 int getIndexOfChild(HierarchyNode child)
          Returns the index of specified child.
 int getNumberOfChildren()
          Returns the number of children.
 HierarchyNode[] getSelectedObjects()
          Returns the array of selected objects.
protected  boolean hasNamedChild(HierarchyNode object)
          Tests if this node has child which name equals to the name of the given node.
 void pasteContent(HierarchyNode[] objects)
          Pastes specified objects to this scene.
protected  void removeChild(HierarchyNode child)
          Removes the specified child node.
 void setFile(java.lang.String fileName)
          Sets the name of the file bounded to this scene.
 void setSelectedObject(HierarchyNode object)
          Sets one object to be selected.
 void setSelectedObjects(HierarchyNode[] objects)
          Sets the array of selected objects.
 
Methods inherited from class j3deditor.bin.hierarchy.HierarchyNode
clone, equals, getIndex, getParent, getParent, getType, setName, setParent, toString, updateName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

J3DeScene

public J3DeScene(java.lang.String name)
Creates an instance of J3DeScene with the given name.

Parameters:
name - the name of the new scene

J3DeScene

public J3DeScene(java.lang.String name,
                 java.lang.String filePath)
Creates an instance of J3DeScene with the given name and if possible loads its contents from specified file.

Parameters:
name - the name of the new scene
filePath - the path of file the contents of the scene will be loaded from
Method Detail

removeChild

protected void removeChild(HierarchyNode child)
Removes the specified child node.

Overrides:
removeChild in class HierarchyNode
Parameters:
child - child node to be removed

getChild

public HierarchyNode getChild(int index)
Returns the child at the specified index.

Overrides:
getChild in class HierarchyNode
Parameters:
index - index of child
Returns:
Returns the child with the specified index

getNumberOfChildren

public int getNumberOfChildren()
Returns the number of children.

Overrides:
getNumberOfChildren in class HierarchyNode
Returns:
Returns the number of children as integer

getIndexOfChild

public int getIndexOfChild(HierarchyNode child)
Returns the index of specified child.

Overrides:
getIndexOfChild in class HierarchyNode
Parameters:
child - child node which index will be returned
Returns:
Returns the index of specified child

hasNamedChild

protected boolean hasNamedChild(HierarchyNode object)
Tests if this node has child which name equals to the name of the given node.

Overrides:
hasNamedChild in class HierarchyNode
Parameters:
object - node which name will be tested
Returns:
Returns true if the name of the given node equals to the name of this node, otherwise false

getBranchGroup

public javax.media.j3d.BranchGroup getBranchGroup()
Returns the BranchGroup object of this scene.

Returns:
Returns the BranchGroup object of this scene

getCamera

public J3DeCamera getCamera()
Returns the J3DeCamera object that manages the ViewingPlatform of this scene.

Specified by:
getCamera in interface VirtualScene
Returns:
Returns the camera of this scene

addNewObject

public void addNewObject(J3DeObject object)
Adds the specified object to this scene.

Parameters:
object - object to be added

addNewObjects

public void addNewObjects(J3DeObject[] objects)
Adds an array of objects to this scene.

Parameters:
objects - array of objects to be added

copyObjects

public void copyObjects()
Copies all selected objects from this scene.


cutObjects

public void cutObjects()
Cuts all selected objects from this scene.


pasteContent

public void pasteContent(HierarchyNode[] objects)
Pastes specified objects to this scene.

Specified by:
pasteContent in interface Pasteable
Parameters:
objects - array of objects to be pasted

deleteObjects

public void deleteObjects(HierarchyNode[] objects)
Deletes specified objects from this scene.

Parameters:
objects - objects to be deleted

setSelectedObject

public void setSelectedObject(HierarchyNode object)
Sets one object to be selected.

Parameters:
object - object to be set selected

setSelectedObjects

public void setSelectedObjects(HierarchyNode[] objects)
Sets the array of selected objects.

Parameters:
objects - array of objects to be set selected

getSelectedObjects

public HierarchyNode[] getSelectedObjects()
Returns the array of selected objects.

Returns:
Returns the array of selected objects

getCopiedObjects

public HierarchyNode[] getCopiedObjects()
Returns the array of copied objects.

Returns:
Returns the array of copied objects

detach

public void detach()
Detatces BranchGroup.


deleteScene

public void deleteScene()
Detaches BranchGroup object and removes this scene from HierarchyManager that contains it.


getFile

public java.lang.String getFile()
Returns the name of file bounded to this scene.

Returns:
Returns the file name bounded to this scene

setFile

public void setFile(java.lang.String fileName)
Sets the name of the file bounded to this scene.

Parameters:
fileName - new name of the file